<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .parent{
            width: 300px;
            height: 300px;
            background-color: orangered;
            position: relative;
            margin: 100px;
            /* display: flex;
            align-items: center;
            justify-content: center; */
            /* display: grid;
            justify-content: center;
            align-content: center; */
        }
        .child{
            width: 100px;
            height: 100px;
            background-color: orchid;
           /* position: absolute;
            top: 50%;left: 50%;
            margin-left: -50px;
            margin-top: -50px; */

             /* position: absolute;
            left: 0;
            right: 0;
            top: 0;
            bottom: 0;
            margin: auto; */

            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%,-50%);
            
        }
    </style>
</head>
<body>
    <div class="parent">
        <div class="child"></div>
    </div>
</body>
</html>